package com.flyan.game.motafx.effect.npc;

import com.almasb.fxgl.entity.Entity;
import com.flyan.game.motafx.core.util.core.GameUtils;
import com.flyan.game.motafx.core.util.entity.EntityUtils;
import com.flyan.game.motafx.effect.BaseEffect;
import com.flyan.game.motafx.ui.TransactionPage;
import javafx.util.Duration;
import org.jetbrains.annotations.NotNull;

/**
 * 交易效果
 *
 * @author flyan
 * @version 1.0
 * @email flyan_by_chenu@sina.com
 * @since 2025/2/10
 */
public class TransactionEffect extends BaseEffect {

    public TransactionEffect() {
        super(Duration.INDEFINITE);
    }

    @Override
    public void onStart(@NotNull Entity entity) {
        TransactionPage page = GameUtils.app().transactionPage;
        TransactionPage.Info transactionInfo = EntityUtils.getEntityProperty(triggerEntity,
                "properties.transactionInfo", TransactionPage.Info.class);
        page.setInfo(transactionInfo);
        page.show();
    }

    @Override
    public void onEnd(@NotNull Entity entity) {

    }

}
